﻿@model FashionStoreMVC.Models.PagingModel
@{
    //ViewBag.Title = "Index";
    //Layout = "~/Views/Shared/_AdminLayout.cshtml";
    Layout = null;

    var listpage = (List<SelectListItem>)ViewBag.listPage;
}


    
       
             <del class="container">
                            <div class="pagination">
                                <div class="limit">Hiển thị #
                                  @Html.DropDownList("selectPage", new SelectList(listpage, "Value", "Text"), new { id = "urlSelect" })
@if (Model.PageTotal > 1)
{
    var currentPage = Request.QueryString["page"] == null ? 1 : int.Parse(Request.QueryString["page"]);
    if (@currentPage == 1)
    {
                                    <div class="button2-right off">
                                        <div class="start">
                                            <span>&lt;&lt;</span>

                                        </div></div>
                                    <div class="button2-right off">
                                        <div class="prev">
                                            <span>&lt;</span>

                                        </div>
                                    </div>
    }
    else
    {
                                    <div class="button2-right on">
                                        <div class="start">
                                            <a href="productmanager?page=1"><span>&lt;&lt;</span></a>

                                        </div></div>
                                    <div class="button2-right on">
                                        <div class="prev">
                                            <a href="productmanager?page=@(currentPage - 1)"><span>&lt;</span></a>

                                        </div>
                                    </div>
    }
                                <div class="button2-left">
                                    <div class="page">
                                        @for (int i = 1; i <= Model.PageTotal; i++)
                                        {
                                            if (currentPage == i)
                                            {
                                         <span>@i</span>
                                       
                                            }
                                            else
                                            {
                                    <span>@Html.Raw(string.Format(Model.PagingTemplate, i))</span>
                                            }
                                        }
                                            </div></div>
                                        if (currentPage == Model.PageTotal)
                                        {
                                 <div class="button2-left off">
                                    <div class="next">
                                        <span>&gt;</span>

                                    </div>

                                </div>
                                <div class="button2-left off">
                                    <div class="end">
                                        <a href="productmanager?page=@Model.PageTotal"><span>&gt;&gt;</span></a>
                                    </div>
                                </div>
                                        }
                                        else
                                        {
                                <div class="button2-left on">
                                    <div class="next">
                                        <a href="productmanager?page=@(currentPage + 1)"><span>&gt;</span></a>

                                    </div>

                                </div>
                                <div class="button2-left on">
                                    <div class="end">
                                        <a href="productmanager?page=@Model.PageTotal"><span>&gt;&gt;</span></a>
                                    </div>
                                </div>
                                        }
                                <div class="limit">Trang @currentPage của @Model.PageTotal</div>
 }
                            </div>
                        </del>
    
       

<script type="text/javascript">
    $(function() {
        $('#urlSelect').change(function () {
            document.forms[0].submit();
        });
    });

</script>